{template /common/header}
	<!-- S header -->
	<header class="login_header">
		<a href="/" class="headerL iconfont">&#xe66a;</a>
		<h1>注册</h1>
	</header>
	<!-- E header -->
	
	<div class="registerBox">
		<form class="registerform" action="{U('User/Public/mobilereg')}" method="post" >
		<ul class="change_num_box">	
			<li class="flex invite_code_box">
				<label class="label">邀请码</label>
				<div class="flex-1 input_box"><input type="text" placeholder="请输入您的邀请码" class="alignR"></div>
			</li>
			<li class="flex">
				<label class="label">昵称</label>
				<div class="flex-1 input_box"><input type="text" placeholder="请输入您的昵称" name="username" ajaxurl="{U('User/Public/ajaxCheckKey')}" datatype="*2-16"  autocomplete="off"   errormsg="用户名不低于两位，使用中文、数字、字母皆可！" nullmsg='用户名不低于两位，使用中文、数字、字母皆可' class="alignR"></div>
			</li>
			<li class="flex">
				<label class="label">手机号</label>
				<div class="flex-1 input_box"><input type="text"  id="mobile_phone" autocomplete="off  ajaxurl="{U('User/Public/ajaxCheckKey')}" datatype="m" errormsg="手机号错误！"  placeholder="请填写手机号码"  name="mobile_phone" nullmsg='请填写手机号码' class="alignR"></div>
			</li>
			<li class="flex">
				<label class="label">图形验证码</label>
				<div class="flex-1 input_box"><input type="text" name="imgcode" id="imgcode" placeholder="请输入图形验证码"  placeholder="请输入图形验证码"  datatype="*"  nullmsg='请输入图形验证码' class="alignR"></div><span class="tx_yzm" onclick="resetImgCode();"><img id="img_code" src="/index.php?m=user&c=public&a=verify&w=85&h=37" width="85" height="37" /></span></li>
			<li class="flex">
				<label class="label">验证码</label>
				<div class="flex-1 input_box"><input type="text" name="mobi_code" id="mobi_code"  placeholder="请输入手机验证码"  datatype="*"  nullmsg='请输入手机验证码' class="alignR"></div>
				<a href="javascript:;" class="get_code send_code">获取验证码</a>
			</li>
			<li class="flex">
				<label class="label">登录密码</label>
				<div class="flex-1 input_box"><input type="password" placeholder="请设置您的登录密码"  datatype="password" errormsg="登录密码范围在6~15位之间！" name="password" id="password" nullmsg='请填写密码，密码范围在6~15位之间' class="alignR"></div>
			</li>
			<li class="flex">
				<label class="label">确认登录密码</label>
				<div class="flex-1 input_box"><input type="password" placeholder="再次输入您的登录密码"   name="firmpawd" datatype="*" recheck="password" nullmsg="请再输入一次密码！" errormsg="您两次输入的账号密码不一致！" class="alignR"></div>
			</li>
			<li class="flex">
				<label class="label">交易密码</label>
				<div class="flex-1 input_box"><input type="password" placeholder="请设置您的交易密码" datatype="pinpass" errormsg="交易密码为6位数字！" name="pinpass" id="pinpass" nullmsg='请填写交易密码，交易密码为6位数字！'  class="alignR"></div>
			</li>
			<li class="flex">
				<label class="label">确认交易密码</label>
				<div class="flex-1 input_box"><input type="password" placeholder="再次输入您的交易密码" name="firmpawd" datatype="*" recheck="pinpass" nullmsg="请再输入一次交易密码！" errormsg="您两次输入的交易密码不一致！"  class="alignR"></div>
			</li>
		</ul>
		</form>

		<a href="" class="service_affirm_btn">注册</a>
		<p class="alignC without_account">已有账户，去<a href="" class="red inline_block">登录</a></p>
	</div>

	<!-- S 实名认证弹窗 -->
	<div class="popup_shade"></div>
	<div class="popup_Certification">
		<ul>
			<li><img src="{THEME_PATH}images/smrz.png" alt="" class="img"></li>
			<li>
				<dl>
					<dt class="title">实名认证 诚信为你</dt>
					<dd class="txt">会员认证后方可进行交易</dd>
				</dl>
			</li>
			<li class="btn_box">
				<button type="button" class="btn btn1">以后再说</button>
				<button type="button" class="btn btn2">立即去报名</button>
			</li>
		</ul>
	</div>
	<!-- S 实名认证弹窗 -->



<script type="text/javascript">
	function resetImgCode(){
		$("#img_code").attr("src",'/index.php?m=user&c=public&a=verify&t='+Math.round(new Date().getTime()/1000));
	}
$(function(){
    $(".send_code").click(function(){
    	console.log(1);
        var text=$(this).text();
        var type=$(this).attr("type");
        if(text!="获取验证码"){
            return false;
        }
        console.log(2);
		var mobile=$("#mobile_phone").val();
		if(mobile==""){
			tips("请填写您的手机号码");
			$("#mobile_phone").blur();
			return;
		}

		var imgcode = $("#imgcode").val();
		if(imgcode==""){
			tips("请填写图形验证码");
			$("#imgcode").blur();
			return;
		}

		$.ajax({
			url: "{U('User/Public/send_code')}&token={$_SESSION[send_code_time]}&type=reg&mobile="+mobile+"&code="+imgcode,
			timeout: 5000,cache: false,type: "get",async : false,dataType: "json",
			success: function (d){
				if(d.status==1){
					 downtime(120);
				}
				tips(d.info);
			}
		});
    })

})

/**

* 验证码倒计时

* time 倒计时时间：秒

**/

function downtime(time){

//循环调用

if(time == '0'){

$('.send_code').text('发送验证码');

}else{

time --;

$('.send_code').text('重新发送('+time+')');

setTimeout(function() {

downtime(time);

},1000);}

}
</script>
<script type="text/javascript">
$(function(){
	$(".registerform").Validform({
		tiptype:function(msg,o,cssctl){
				if(o.type==3){
					layer.closeAll();
					//$(".errmsg").text(msg).show();
					tips(msg);
					return false;
				}
				if(o.type==1){
					o.obj.addClass("Validform_success")
				}
			},
			datatype:{
				"password": function( gets , obj , curform , regxp ){
					 var reg1=/^[^\s]{6,15}$/;
					 if(!reg1.test(gets)){
						return "登录密码范围在6~15位之间";
					 }
				},
				"pinpass": function( gets , obj , curform , regxp ){
					 var reg1=/^[0-9]{6,6}$/;
					 if(!reg1.test(gets)){
						return "支付密码必须为六位数字";
					 }else{
						return true;	 
					 }
				},				
				"need1": function( gets , obj , curform , regxp ){
					var need=1,
						numselected=curform.find("input[name='"+obj.attr("name")+"']:checked").length;
					return  numselected >= need ? true : "请阅读注册协议";
				}
			},
		ajaxPost: true,
		callback: function(ret) {
			layer.closeAll();
			if (ret.status == 0) {
				//$(".errmsg").text(ret.info).show();
				tips(ret.info);
			} else {
				location.href = "{U('user/index/index')}";
			}
		}
	});
});
$(function(){
	function handle(){
		var e = document.getElementById('phone').value.length;
		if(e==11){
			document.getElementById('smsCode').removeAttribute("disabled");
		}
	}
	$('.kv-k').focus(function(){
		var kvw = $('.kv-k').width()-106;
		$('.kv-k').css({"width":kvw});
	});
	$('.kv-k').blur(function(){
		$('.kv-k').css({"width":"100%"});
	});
})




</script>


</body>
</html>